'use strict';
var Schema = require('mongoose').Schema,
    Model = require('../../../Base/server/controllers/Model');

var modelField = {};
//物料
modelField.ItemMaster = {
    type: Schema.ObjectId,
    ref: 'ItemMaster'
};
//要货部门
modelField.DemandDepartment = {
    type: Schema.ObjectId,
    ref: 'Department'
};
//待转区
modelField.WareHouse = {
    type: Schema.ObjectId,
    ref: 'WareHouse'
};
//累计要货量
modelField.TotalDemandQty = {
    type: Number
};
//累计备货量
modelField.TotalStockQty = {
    type: Number
};
//累计已接收量
modelField.TotalReceiveQty = {
    type: Number
};
//扩展字段:
modelField.DescSeg1 = {
    type: String,
    default: '',
    trim: true
};
modelField.DescSeg2 = {
    type: String,
    default: '',
    trim: true
};

var newModel = new Model(modelField);
newModel.addIndex({ItemMaster: 1, WareHouse: 1, DemandDepartment: 1, DescSeg1: 1, DescSeg2: 1}, {"unique": true});
newModel.create('KanbanDemand', '看板需求');
